package com.cn.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/yzm")
public class Yzm extends BaseServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		Integer yzm = (int) ( Math.random()*9999+1);
		resp.getWriter().print(yzm);
		req.getSession().setAttribute("yzm", yzm);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.getWriter().print(req.getSession().getAttribute("yzm"));
	}
}
